;(function () {
  new Vue({
    el: '#finicialDocumentHome',
    data: {
      tabData:[
        {'name':'账套设置', disabled: true},
        {'name':'辅助核算', disabled: true},
        {'name':'现金流', disabled: true},
        {'name':'会计科目', disabled: true},
        {'name':'凭证类型', disabled: true},
        {'name':'凭证规则', disabled: true},
      ],
      tabSelectedIndex:0,
      isShowFlag:true
    },
    mounted(){
      const tabIndex = hlUrlUtil.GetQueryString('tabIndex') || this.tabSelectedIndex
      this.renderView(tabIndex)
    },
    methods:{
      renderView(index){
        let i = typeof index == 'number' ? index : Number(index)
        switch (i) {
          case 0:
              $('.finicial-doc-view-content').load('modules/system_config/page/finicial_books_config.html')
            break;
          case 1:
              $('.finicial-doc-view-content').load('modules/system_config/page/assist_accounting.html')
            break;
          case 2:
              $('.finicial-doc-view-content').load('modules/system_config/page/cash_flow.html')
            break;
          case 3:
              $('.finicial-doc-view-content').load('modules/system_config/page/accounting_subject_config.html')
            break;
          case 4:
              $('.finicial-doc-view-content').load('modules/system_config/page/finicial_doc_type_config.html')
            break;
          case 5:
              $('.finicial-doc-view-content').load('modules/system_config/page/finicial_voucher_rule_config_one.html')
            break;
          default:
        }
      },
      handleTabClick(val,i){
				if (hlUrlUtil.GetQueryString('isTab') == 'false') {
					hl.toast('请先创建账套设置')
					this.tabData = [
            {'name':'账套设置', disabled: true},
            {'name':'辅助核算', disabled: true},
            {'name':'现金流', disabled: true},
            {'name':'会计科目', disabled: true},
            {'name':'凭证类型', disabled: true},
            {'name':'凭证规则', disabled: true},
					]
					return
				}
				if (hlUrlUtil.GetQueryString('isTab') == 'true') {
					this.tabData = [
            {'name':'账套设置', disabled: true},
            {'name':'辅助核算', disabled: true},
            {'name':'现金流', disabled: true},
            {'name':'会计科目', disabled: true},
            {'name':'凭证类型', disabled: true},
            {'name':'凭证规则', disabled: true},
					]
					this.tabSelectedIndex = i
				}

        if(this.tabData[i]['disabled'] !== false) this.renderView(i)
      }
    }
  })

}())
